package com.hzj.controller;

import com.hzj.pojo.Patient;
import com.hzj.service.PatientService;
import com.hzj.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author Aisling
 * @date 2021-05-13 9:52
 */
@RestController
@RequestMapping("/platformapi/user/patient")
public class PatientController {

    @Autowired
    PatientService ps;

    @PostMapping("/auth/get/{id}")
    public Result getById(@PathVariable Integer id){
        return Result.ok(ps.getById(id));
    }

    @PostMapping("/auth/save")
    public Result save(@RequestBody Patient patient){
        return ps.save(patient);
    }

    @PostMapping("/auth/update")
    public Result updateById(@RequestBody Patient patient){
        return ps.updateById(patient);
    }

    @PostMapping("/auth/remove/{id}")
    public Result removeById(@PathVariable Integer id){
        return ps.removeById(id);
    }
}
